import java.util.Scanner;

public class Hanoi {
//    A         B           C
//    一阶汉诺塔：A->C
//    二阶汉诺塔：A->B A->C B->C
//

    /**
     *
     * @param n 盘子的数目
     * @param origin 源柱
     * @param assist 辅助柱
     * @param destination 目的柱
     */
    public static void hanoi(int n,char origin,char assist,char destination){
        if(n==1) {
            move(n,origin,destination);
        } else {
            hanoi(n-1,origin,destination,assist);
            move(n,origin,destination);
            hanoi(n-1,assist,origin,destination);
        }
    }

    public static void move(int n,char origin,char destination) {
        System.out.println("移动第"+n+"个圆盘: "+origin+" -> "+destination);
    }


    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        System.out.print("汉诺塔的层数:");
        int n= scan.nextInt();

        hanoi(n,'A','B','C');
    }
}


